<template>
  <el-card class="app-container">
    <c-u-r-d-table :option="option"/>

    <comment-list-dialog :showed.sync="commentDialogShowed" :business-id="currentRow.id" :business-type="0"/>
  </el-card>
</template>

<script>

import ColumnType from '@/framework/constant/ColumnType'
import OnlineStatusEnum from '@/framework/constant/OnlineStatusEnum'
import { trendApi } from '@/feature/cms/infra/api/trendApi'
import CURDTable from '@/framework/components/table/CURDTable'
import CommentListDialog from '@/feature/cms/components/CommentListDialog'

export default {
  components: { CommentListDialog, CURDTable },
  data() {
    return {
      currentRow: {},
      commentDialogShowed: false,
      option: {
        requestApi: trendApi,
        columns: [
          {
            label: 'ID',
            width: 60,
            prop: 'id'
          },
          // {
          //   label: '用户ID',
          //   prop: 'userId',
          //   searchable: true,
          //   type: ColumnType.SELECT
          // },
          {
            label: '用户昵称',
            prop: 'userInfo.nickName'
          },
          {
            label: '用户头像',
            prop: 'userInfo.headImg',
            type: ColumnType.IMAGE
          },
          {
            label: '动态内容',
            oneLine: true,
            searchable: true,
            width: 300,
            prop: 'content'
          },
          {
            label: '动态图片',
            prop: 'pics',
            type: ColumnType.IMAGE
          },
          {
            label: '点赞数',
            prop: 'likeNum',
            type: ColumnType.NUMBER
          },

          {
            label: '评论数',
            prop: 'commentNum',
            type: ColumnType.NUMBER
          },
          {
            label: '转发数',
            prop: 'transmitNum',
            type: ColumnType.NUMBER
          },
          {
            label: '状态',
            searchable: true,
            type: ColumnType.RADIO,
            hiddenInForm: true,
            options: OnlineStatusEnum,
            prop: 'status'
          },
          {
            label: '创建时间',
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtCreate'
          },
          {
            label: '修改时间',
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtModified'
          }
        ]
      }
    }
  },
  methods: {
    handleComment({ arg }) {
      this.currentRow = arg
      this.commentDialogShowed = true
    }
  }
}
</script>

